/*

 *
 */

package com.ruifu.common.feign;

import com.fhzncloud.cloud.common.core.constant.SecurityConstants;
import com.fhzncloud.cloud.common.core.util.PageR;
import com.ruifu.common.constant.BizServiceNameConstants;
import com.ruifu.common.feign.factory.RemoteActServiceFallbackFactory;
import com.ruifu.common.vo.actanddoc.ActivitiVO;
import com.ruifu.common.vo.actanddoc.Flag;
import com.ruifu.common.vo.actanddoc.ProccessTaskVO;
import com.ruifu.common.vo.actanddoc.ProcessParams;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author liun
 * @date 2020/5/6
 */
@FeignClient(contextId = "remoteActService", value = BizServiceNameConstants.ACT_SERVICE, fallbackFactory = RemoteActServiceFallbackFactory.class)
public interface RemoteActService {

	/**
	 * 提交启动流程
	 * @param processParams
	 * @return
	 */
	@PostMapping(value = "/act/submitDocument")
	Flag submitDocument(@RequestBody ProcessParams processParams);

	/**
	 * 待处理
	 *
	 * @return
	 */
	@PostMapping(value = "/act/iReview/{page}/{size}")
	PageR<List<ActivitiVO>> iReview(@PathVariable(value = "page", required = false) Integer page,
									@PathVariable(value = "size", required = false) Integer size);

	/**
	 * 已处理
	 *
	 * @return
	 */
	@PostMapping(value = "/act/queryDoneTasks/{page}/{size}")
	PageR<List<ActivitiVO>> queryDoneTasks(@PathVariable(value = "page", required = false) Integer page,
										   @PathVariable(value = "size", required = false) Integer size);

	/**
	 * 通过/驳回/重新提交
	 * @param processParams
	 * @return
	 */
	@PostMapping(value = "/act/pass")
	Flag flag(@RequestBody ProcessParams processParams);

	/**
	 * 获取节点信息计算流程权限
	 *
	 * @param businessKey
	 * @return
	 */
	@GetMapping(value = "/act/nowTask/businessKey/{Id}")
	ProccessTaskVO getNowTaskNode(@PathVariable("Id") String businessKey);

	/**
	 * 从默认账套的模板数据中拷贝模板信息到新的账套(内部方法)
	 *
	 * @param sourceTenantId
	 * @param targetTenantId
	 * @param from
	 * @return
	 */
	@GetMapping(value = "/model/tenantTemplateCopy/{sourceTenantId}/{targetTenantId}")
	Boolean TenantTemplateCopy(@PathVariable("sourceTenantId") Integer sourceTenantId,
							   @PathVariable("targetTenantId") Integer targetTenantId,
							   @RequestHeader(SecurityConstants.FROM) String from);
}
